/** COPYRIGHT(C) 2008. Loc Phan. All Rights Reserved.
    A Dataset class that take in integer and manipulate them
    with various methods.
    @author Loc Phan
    @version 1.01 2008-10-28
*/
public class DataSet
{
   /**Constructs a dataset
    * 
    */
   public DataSet()
   {
      largest = Integer.MIN_VALUE;
      smallest = Integer.MAX_VALUE;
      total = 0;
      count = 0;
   }
   
   /**Takes in value
    * 
    * @param x Integer that needed to process
    */
   public void addValue(int x)
   {
      count++;
      total = total + x;

      if ( x > largest )
         largest = x;

      if ( x < smallest )
         smallest = x;
   }
   /**Return largest value
    * 
    * @return Largest input value
    */
   public int getLargest()
   {
      return largest;
   }
   
   /**Return smallest value
    * 
    * @return Smallest input value
    */
   public int getSmallest()
   {
      return smallest;
   }
   /**Sum of all input integers
    * 
    * @return Sum
    */
   public int getSum()
   {
      return total;
   }
   
   /**Average of all input integers
    * 
    * @return Average
    */
   public double getAverage()
   {
      return (double) (total) / count;
   }
   private int total;
   private int count;
   private int largest;
   private int smallest;
}